package cn.seqdata.jackson;

import java.io.IOException;

import org.springframework.util.NumberUtils;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

public class LongDeserializer extends StdDeserializer<Long> {
	private static final long serialVersionUID = 1L;

	protected LongDeserializer() {
		super(Long.class);
	}

	@Override
	public Long deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
		return NumberUtils.parseNumber(jp.getText(), Long.class);
	}
}
